using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Content_And_Topic - 专题和内容对应表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleContentAndTopic<T> :ModelBase<ArticleContentAndTopic> where T : ArticleContentAndTopic, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.RowId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return RowId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.RowId=dy.RowId;
           this.TopicId=dy.TopicId;
           this.ContentId=dy.ContentId;
           this.Sno=dy.Sno;
           this.TopNum=dy.TopNum;
        } 

        #region 定义属性

     
         /// <summary>
        /// 流水ID
        /// </summary>
        private String _RowId = "";
      
        /// <summary>
        /// 流水ID
        /// </summary>
        public String RowId
        {
            get 
            {
              return   (this._RowId); 
            }

            set 
            {
                    _RowId= value;  
            }
        }
       
     
         /// <summary>
        /// 专题ID
        /// </summary>
        private String _TopicId = "";
      
        /// <summary>
        /// 专题ID
        /// </summary>
        public String TopicId
        {
            get 
            {
              return   (this._TopicId); 
            }

            set 
            {
                    _TopicId= value;  
            }
        }
       
     
         /// <summary>
        /// 内容ID
        /// </summary>
        private String _ContentId = "";
      
        /// <summary>
        /// 内容ID
        /// </summary>
        public String ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 排序
        /// </summary>
        private int _Sno =int.MinValue;
      
        /// <summary>
        /// 排序
        /// </summary>
        public int Sno
        {
            get 
            {
              return   (this._Sno); 
            }

            set 
            {
                    _Sno= value;  
            }
        }
       
     
         /// <summary>
        /// 置顶
        /// </summary>
        private int _TopNum =int.MinValue;
      
        /// <summary>
        /// 置顶
        /// </summary>
        public int TopNum
        {
            get 
            {
              return   (this._TopNum); 
            }

            set 
            {
                    _TopNum= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleContentAndTopic info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["RowId"]!= DBNull.Value)
                  {
                  info.RowId=row["RowId"].ToString();
                 }
                 
                  
                  if(row["TopicId"]!= DBNull.Value)
                  {
                  info.TopicId=row["TopicId"].ToString();
                 }
                 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=row["ContentId"].ToString();
                 }
                 
                  
                  if(row["Sno"]!= DBNull.Value)
                  {
                  info.Sno=Convert.ToInt32(row["Sno"]);
                 }
                 
                  
                  if(row["TopNum"]!= DBNull.Value)
                  {
                  info.TopNum=Convert.ToInt32(row["TopNum"]);
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleContentAndTopic info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@RowId", DbType.String,ParameterTool.GetObj( info._RowId )); 
            
             
                cn.AddInParameter(comm, "@TopicId", DbType.String,ParameterTool.GetObj( info._TopicId )); 
            
             
                cn.AddInParameter(comm, "@ContentId", DbType.String,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@Sno", DbType.Int32,ParameterTool.GetObj( info._Sno )); 
            
             
                cn.AddInParameter(comm, "@TopNum", DbType.Int32,ParameterTool.GetObj( info._TopNum )); 
            
        } 

    } 
} 